package com.test;


import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
import java.util.Set;

public class Main04
{
    public static void main(String[] args)
    {
//        f2();
        fun("ABCBC","B","CC");
    }

    public static void f1()
    {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        List<String> list = new ArrayList<>();
        if (s.length() == 0)
        {
            return;
        }
        for (int i = 0; i < s.length(); i++)
        {
            if (list.contains(s.substring(i, i + 1)))
            {
                continue;
            }
            else
            {
                list.add(s.substring(i, i + 1));
            }
        }
        for (int i = 0; i < list.size(); i++)
        {
            System.out.print(list.get(i));
        }
    }

    public static void f2()
    {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        String[] s1 = s.split(" ");

        for (int i = s1.length - 1; i >= 0; i--)
        {
            System.out.print(s1[i] + " ");
        }
    }

    public static void fun(String A, String B, String C)
    {
        int lenB = B.length();
        int lenC = C.length();
        while (A.contains(B))
        {
            int index = A.indexOf(B);
            A = A.substring(0,index) + C + A.substring(index + lenB);
        }
        System.out.println(A);
    }
}
